Preserving large pages of memory across live migrations of workloads

ABSTRACT

A method of preserving the contiguity of large pages of a workload during migration of the workload from a source host to a destination host includes the steps of: detecting at the destination host, receipt of a small page of zeros from the source host, wherein, at the source host, the small page is part of one of the large pages of the workload; and upon detecting the receipt of the small page of zeros, storing, at the destination host, all zeros in a small page that is part of one of the large pages of the workload.

BACKGROUND

In a virtualized computing system, a computing platform of a physicalhost may be encapsulated into virtual machines (VMs) runningapplications. A VM abstracts the processing, memory, storage, and thelike of the computing platform for a guest operating system (OS) of theVM. Virtualization software on a host, also referred to as a“hypervisor,” provides an execution environment for VMs, and avirtualization manager migrates VMs between hosts. Such migrations maybe performed “live,” i.e., while VMs are running. For such livemigrations, one goal is to migrate VMs with minimal impact onperformance.

Prior to a “switch-over” in which a VM is “quiesced” on a source hostand resumed on a destination host, various operations are performed onthe VM. Such operations include copying the state of the VM's memoryfrom the source host to the destination host. However, until the VM isswitched over to the destination host, the VM continues executingapplications at the source host. During this execution, some of thememory of the source host that is copied to the destination host islater modified by the VM at the source host. As such, an iterative“pre-copying” phase may be used in which at a first iteration, all theVM's memory is copied from the source host to the destination host.Then, during each subsequent iteration, memory of the source host, thathas been modified is copied again to the destination host.

During the pre-copying phase, the VM's memory may be copied to thedestination host in relatively small units, e.g., in 4-KB “pages.” Theuse of small units reduces the amplification of “dirty” data byisolating the modifications made between iterations to smaller units ofmemory. For example, if a few modifications are made in a certain memoryregion, it is preferable to only retransmit, a few 4-KB pages thatcontain the modifications than to retransmit an entire, e.g., 2-MB pagethat contains the modifications.

Although the VM's memory may be copied to the destination host inrelatively small units, the hypervisors of the source and destinationhosts may employ virtual memory spaces that divide memory into largerunits. For example, the VM may employ a virtual address space thatdivides memory into “small” 4-KB pages. However, the hypervisors mayemploy separate virtual address spaces that divide memory into “large”2-MB pages, each large page containing 512 contiguous 4-KB pages.

Use of large pages is generally advantageous for virtual memory systemperformance. For an application of a VM to touch system memory of thedestination host, the application may issue an input/output operation(IO) to a virtual address of the VM, also referred to as a “guestvirtual address.” The guest virtual address may be translated into aphysical memory address of system memory by “walking,” i.e., traversingtwo sets of page tables that contain mapping information: a first setmaintained by the VM and a second set maintained by the hypervisor. Thepage tables maintained by the hypervisor are referred to as “nested”page tables. To speed up translation, a translation lookaside buffer(TLB) may be utilized that contains beginning-to-end mappings of guestvirtual addresses to physical memory addresses. However, such a TLB islimited in size and thus only contains some mappings, e.g., those ofrecently accessed guest virtual addresses. When an application requeststo access memory at a guest virtual address for which the TLB containsno mapping, a “TLB miss” occurs, and the page tables must be walked. Useof relatively large pages minimizes the number of TLB misses and thusminimizes the number of expensive page-table walks.

When a VM is migrated to a destination host, the nested page tables ofthe destination host do not contain mappings from the VM's address spaceto physical memory addresses of the destination host. As such, inexisting systems, once the VM resumes on the destination host and beginsaccessing memory at various virtual addresses, new mappings must becreated on demand. If the hypervisor's virtual memory space at thesource host is divided into large pages, it is advantageous for suchlarge pages to be preserved at the destination host. In other words, alarge page at the source host should also be mapped as a large page atthe destination host with the same contiguous small memory pages at thesame positions relative to the large pages. As a result, when largepages are preserved at the destination host, the virtual addresses ofsmall pages may be mapped in place.

If the large pages are not preserved at the destination host, new largepages at the destination host need to be allocated to a VM, and thecontents of each small page must be copied to a large page. Such aprocess requires significantly more CPU resources than mapping the smallpages in place.

SUMMARY

Accordingly, one or more embodiments provide a method of preserving thecontiguity of large pages of a workload during migration of the workloadfrom a source host to a destination host. The method includes the stepsof: detecting at the destination host, receipt of a small page of zerosfrom the source host, wherein, at the source host, the small page ispart of one of the large pages of the workload; and upon detecting thereceipt of the small page of zeros, storing, at the destination host,all zeros in a small page that is part of one of the large pages of theworkload.

Further embodiments include a non-transitory computer-readable storagemedium comprising instructions that cause a host to carry out the abovemethod, as well as a computer system configured to carry out the abovemethod.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a host computer that may be used for a livemigration of a VM, according to embodiments.

FIG. 2A is a block diagram of memory page tables in a page tablehierarchy, according to embodiments.

FIG. 2B is a block diagram illustrating an example of an address thatmay be used to walk memory page tables, according to embodiments.

FIG. 3A is a block diagram of a virtualized computing system in which aVM may be migrated from a source host to a destination host, accordingto embodiments.

FIG. 3B is a block diagram illustrating the structure of a VM's memoryat a source host before a migration and the structure of the VW's memoryat a destination host after the migration, according to embodiments.

FIG. 4 is a flow diagram of steps carried out to perform a method ofmigrating a VM from a source host to a destination host, according to anembodiment.

FIG. 5 is a flow diagram of steps carried out to perform a method ofstoring zeros in a small page of memory of a destination host during aVM migration, according to an embodiment.

FIG. 6 is a flow diagram of steps carried out to perform a method ofstoring the updated contents of a remote small page of memory in adestination host during a VM migration, according to an embodiment.

DETAILED DESCRIPTION

Embodiments provide two new techniques for transferring memory pages ofa workload that preserve the contiguity of those memory pages that aremapped as large pages. According to the first technique, when a smallmemory page of zeros is transferred from a source host to a destinationhost, the small memory page is stored at the destination host within thesame large memory page of the workload as at the source host. Accordingto the second technique, when a small page with contents modified at thesource host is received at the destination host after the workload isresumed at the destination host, the small memory page with modifiedcontents is stored at the destination host within the same large memorypage of the workload as at the source host. By preserving large pagecontiguity on the destination host in this manner, the performancebenefits associated with large pages will be maintained at thedestination host. For example, preserving large pages and mapping smallpages in place drastically reduces the downtime of a VM duringmigration.

FIG. 1 is a block diagram of a host computer (also referred to as “host”for short) 100 that may be used for a live migration of a VM 110,according to embodiments. Host 100 may be a physical computer serverconstructed on a server grade hardware platform 104 such as an x86architecture platform.

Hardware platform 104 includes conventional components of a computingdevice, such as one or more central processing units (CPUs) 160, systemmemory 170 such as random-access memory (RAM), optional local storage180 such as one or more hard disk drives (HDDs) or solid-state drives(SSDs), and one or more network interface cards (NICs) 190. CPU(s) 160are configured to execute instructions such as executable instructionsthat perform one or more operations described herein, which may bestored in system memory 170. Local storage 180 may also optionally beaggregated and provisioned as a virtual storage area network (vSAN).NIC(s) 190 enable host 100 to communicate with other devices over aphysical network (not shown).

Each CPU 160 includes one or more cores 162, memory management units(MMUs) 164, and TLBs 166. Each core 162 is a microprocessor such as anx86 microprocessor. Each MMU 164 is a hardware unit that supports“paging” of system memory 170. Paging provides a virtual memoryenvironment in which a virtual address space is divided into pages, eachpage being an individually addressable unit of memory. Each page furtherincludes a plurality of separately addressable data words, each of whichincludes one or more bytes of data. Pages are identified by addressesreferred to as “page numbers.” CPU(s) 160 can support multiple pagesizes including 4-KB, 2-MB, and 1-GB page sizes.

Page tables are arranged in a hierarchy that may include various levels.Each page table includes entries, each of which specifies controlinformation and a reference to either another page table or to a memorypage. The hierarchy and individual structures of page tables will bedescribed further below in conjunction with FIG. 2A. In the exampleshown in FIG. 1 , guest page tables 116 are used to translate guestvirtual addresses to “guest physical page numbers” (PPNs), i.e.,addresses that appear to be physical memory addresses from theperspective of a VM 110 but that are actually virtual addresses from theperspective of host computer 100. Nested page tables 142 are used totranslate PPNs to machine page numbers MPNs) of system memory 170. Aguest OS 114 and hypervisor 120 expose their respective page tables toCPU(s) 160.

MMU(s) 164 traverse or “walk” the page tables to translate virtual pagenumbers to physical page numbers, from guest virtual addresses to PPNsusing guest page tables 116 and from PPNs to MPNs using nested pagetables 142. TLB(s) 166 are caches that store full address translationsfor MMU(s) 164 from guest virtual addresses to MPNs. A CPU 160 maycontain an MMU 164 and a TLB 166 for each core 162. If valid andpresent, an MMU 164 obtains a translation from a guest virtual addressto an MPN directly from a TLB 166. Otherwise, an MMU 164 traverses thepage tables to obtain the translation.

Software platform 102 includes a hypervisor 120, which is avirtualization software layer that abstracts hardware resources ofhardware platform 104 for concurrently running VMs 110. One example of ahypervisor 120 that may be used is a VMware ESXi™ hypervisor by VMware,Inc. Each VM 110 includes one or more applications 112 running on aguest OS 114 such as a Linux® distribution. Guest OS 114 maintains guestpage tables 116 for each of the applications running thereon.

Hypervisor 120 includes a kernel 130, VM monitors (VMMs) 140, and a VMmigration module 150. Kernel 130 provides OS functionalities such asfile system, process creation and control, and process threads. Kernel130 also provides CPU and memory scheduling across VMs 110, VMMs 140,and VM migration module 150. During migration of VM 110 to a destinationhost computer, kernel 130 of the destination host computer maintainsbacking metadata 132. Backing metadata 132 includes MPNs of systemmemory 170 at which migrated memory pages are stored, and associatesthese MPNs to PPNs of the migrated memory pages. Backing metadata 132also includes flags indicating types and properties of such migratedmemory pages, including whether such pages are backed by large pages andwhether such pages are “remote” pages.

VMMs 140 implement the virtual system support needed to coordinateoperations between VMs 110 and hypervisor 120. Each VMM 140 manages avirtual hardware platform for a corresponding VM 110. Such a virtualhardware platform includes emulated hardware such as virtual CPUs(vCPUs) and guest physical memory. Each VMM 140 also maintains nestedpage tables 142 for a corresponding VM 110, as discussed further below.

VM migration module 150 manages migrations of VMs 110 between hostcomputer 100 and other host computers. VMMs 140 and VM migration module150 include metadata 144 and 152, respectively, which are used fordetecting modified memory pages during migration of VM 110 from hostcomputer 100. Metadata 144 and 152 are described further below inconjunction with FIG. 4 .

FIG. 2A is a block diagram of memory page tables in a page tablehierarchy 200, according to embodiments. In the embodiment of FIG. 2A,page table hierarchy 200 is a four-level hierarchy such as can beconfigured for use by CPU(s) 160 of FIG. 1 . However, page tablehierarchies may include more or less than four levels. Furthermore, pagetable hierarchy 200 could correspond to either of guest page tables 116or nested page tables 142.

Page table hierarchy 200 includes a base page table 210, level 3 (L3)page tables 220, level 2 (L2) page tables 230, and level 1 (L1) pagetables 240. L3 includes a number of page tables 220 corresponding to thenumber of page table entries (PTEs) in base page table 210, e.g., 512 L3page tables 220. L2 includes a number of page tables 230 correspondingto the product of the number of PTEs per L3 page table 220 and the totalnumber of L3 page tables 220, e.g., 512 × 512 = 512 ² L2 page tables230. L1 includes a number of page tables 240 corresponding to theproduct of the number of PTEs per L2 page table 230 and the total numberof L2 page tables 230, e.g., 512 × 512 ² = 512 ³ L1 page tables 240.

In the example of FIG. 2A, each PTE of L1 page tables 240 controls a4-KB memory region, i.e., contains an address 242 that is either a PPNcorresponding to a 4-KB VM memory page in the case of guest page tables116 or an MPN corresponding to a 4-KB VM memory page in the case ofnested page tables 142. Each PTE of the L2 page tables 230 controls a2-MB memory region, i.e., contains an address 232 of an L1 page table240 containing 512 4-KB PTEs. Each PTE of the L3 page tables 220controls a 1-GB memory region, i.e., contains an address 222 of an L2page table 230 containing 512 2-MB PTEs. As such, in the example of FIG.2A, a virtual address space is divided into 4-KB pages. However, forexample, in the case of a virtual address space that is divided into2-MB pages, PTEs in the L2 page tables 230 may contain PPNs or MPNscorresponding to 2-MB VM memory pages. Furthermore, page table hierarchy200 may also be configured with different page sizes at each level.

Each PTE of page table hierarchy 200 also includes various control bits.Control bits may include flags such as a “present” flag indicatingwhether a mapping is present, a “dirty” flag indicating whether atranslation is performed in response to a write instruction, and a “PS”flag indicating whether a PTE maps to a page table or to a memory page.For example, the control bits 244 of PTEs in L1 page tables 240 maycontain PS flags that are set, indicating that such PTEs contain eitherPPNs or MPNs. On other hand, the control bits 214, 224, and 234 of PTEsin base page table 210, L3 page tables 220, and L2 page tables 230 maycontain PS flags that are unset, indicating that such PTEs containaddresses of other page tables.

FIG. 2B is a block diagram illustrating an example of an address 250that may be used to walk memory page tables, according to embodiments.Address 250 is formatted for the four-level page table hierarchy 200shown in the example of FIG. 2A.

Within address 250, an L3 page table number 252 selects a PTE in basepage table 210 that points to an L3 page table 220. An L2 page tablenumber 254 selects a PTE in an L3 page table 220 that points to one ofL2 page tables 230. An L1 page table number 256 selects a PTE in an L2page table 230 that points to one of L1 page tables 240. A page number258 selects a PTE in an L1 page table 240 that contains a PPN or MPNcorresponding to a 4-KB VM memory page.

An offset 260 specifies a position within a selected 4-KB VM memorypage. However, for example, in the case of a virtual memory space thatis instead divided into 2-MB pages, the L1 page table number 256 may beeliminated, the page number 258 may select a PTE in an L2 page table 230that contains a PPN or MPN corresponding to a 2-MB VM memory page, andthe offset 260 may specify a position within a selected 2-MB VM memorypage.

FIG. 3A is a block diagram of a virtualized computing system 300 inwhich a VM may be migrated from a source host 100S to a destination host100D, according to embodiments. Host computer 100S includes a VM 110Sand system memory 170S. VM 110S manages a portion of system memory 170Sreferred to as VM memory 310. Source host 100S is connected by a network302 to a destination host 100D to which VM 110S is to be migrated.Network 302 may be, e.g., a physical network that enables communicationbetween hosts 100S and 100D and between other components and hosts 100Sand 100D.

Virtualized computing system 300 further includes a virtualizationmanager 320 and shared storage 330. Virtualization manager 320 performsadministrative tasks such as managing hosts 100S and 100D, provisioningand managing VMs therein, migrating VM 110S from source host 100S todestination host 100D, and load balancing between hosts 100S and 100D.Virtualization manager 320 may be a computer program that resides andexecutes in a server or, in other embodiments, a VM executing in one ofhosts 100S and 100D. One example of a virtualization manager 320 is theVMware vCenter Server® by VMware, Inc.

After migration of VM 1105 from source host 100S to destination host100D, VM 110S runs as VM 110D in destination host 100D. The image of VM110D in system memory 170D is depicted as VM memory copy 310C, which isa copy of VM memory 310.

Shared storage 330 accessible by hosts 100S and 100D includes VM files332, which include, e.g., application and guest OS files. Although theexample of FIG. 3A includes VM files 332 in shared storage 330, thetechniques described herein can also be employed in VM migrations inwhich each host accesses VM files on separate storage systems. In suchan embodiment, VM files 332 are copied from a source storage system to adestination storage system.

FIG. 3B is a block diagram illustrating the structure of VM memory 310at source host 100S before a migration and the structure of VM memorycopy 310C at destination host 1001) after the migration, according toembodiments. As illustrated in FIG. 313 , when small pages 342 arecopied from source host 100S to destination host 100D, the contents arestored in corresponding small pages 352. Small pages 342 and 352 are,e.g., contiguous 4-KB VM memory pages that form large pages 340 and 350,respectively. Large pages 340 and 350 are, e.g., 2-MB VM memory pages.Each small page 342 is stored at the same memory position relative tolarge page 340 as each small page 352 is stored relative to large page350. Large pages 340 and 350 can thus be said to correspond to eachother and to contain the same small pages. Such correspondence isdesired to preserve all the large pages of VM memory 310 when VM memory310 is copied from source host 100S to destination host 100D.

FIG. 4 is a flow diagram of steps carried out to perform a method 400 ofmigrating a VM from a source host to a destination host, according to anembodiment. Method 400 will be explained with reference to source anddestination hosts 100S and 100D of FIG. 3A. Method 400 can be performedthrough cooperation of VM migration modules 150 in hosts 100S and 100D,which are referred to generally herein as “VM migration software.”

At step 402, the VM migration software creates a VM on destination host100D, e.g., VM 110D. At this point in method 400, VM 110D is notstarted. At step 404, the VM migration software executes an iterativepre-copying of VM memory 310 from source host 100S to destination host100D. The pre-copying spans steps 406-416. During the pre-copying phase,VM 110S continues executing at source host 100S and can modify memorypages that have already been copied to destination host 100D. The VMmigration software tracks modified pages of VM memory 310 betweeniterations of pre-copying, such modified memory pages also referred toas “dirty” memory pages.

At step 406, the VM migration software installs “write traces” on allpages of VM memory 310 to track which memory pages are subsequentlydirtied. There are various techniques for tracking and enforcing writetraces. The installation of write traces is further described in U.S.patent application Ser. No. 17/002,233, filed Aug. 25, 2020, the entirecontents of which are incorporated herein by reference. VMM 140 insource host 100S maintains metadata 144 which identify the pages of VMmemory 310 that are being traced. When VM 110S writes to a traced memorypage, the VM migration software is notified, which is referred to as a“trace fire,” and the VM migration software tracks such pages as “dirty”in metadata 152. Alternative to write tracing, the VM migration softwaresets “read-only” flags in PTEs referencing pages of VM memory 310 totrack which memory pages are subsequently dirtied. When VM 110S writesto any read-only page, a fault is triggered, and the fault handlernotifies the VM migration software that the read-only page has beenwritten to. In response, the VM migration software tracks such pages as“dirty” in metadata 152. At step 408, the VM migration softwaretransmits all pages of VM memory 310 to destination host 100D along withPPNs of such pages and metadata indicating whether the pages are backedby large pages. VM memory 310 is transmitted in units of 4-KB pages,although larger page sizes can be used. When these pages are stored indestination host 100D, backing metadata 132 maintained in destinationhost 100D is updated with the PPN to MPN mappings for these pages and toset flags for those pages that are backed by large pages.

At step 410, the VM migration software accesses metadata 152 todetermine how many pages of VM memory 310 have been dirtied since thelast installation of write traces, e.g., while the pages were beingtransmitted to destination host 100D, and compares the amount of time itwould take to retransmit these dirty pages to a defined threshold. Theamount of time depends on both the total size of the dirty pages and thetransmission bandwidth. At step 412, if the amount of time is below thethreshold, method 400 moves to step 418. Otherwise, method 400 moves tostep 414, and the VM migration software re-installs write traces on thedirty pages of VM memory 310. The VM migration software does not need tore-install write traces on the other pages of VM memory 310. At step416, the VM migration software retransmits the dirty pages of VM memory310 to destination host 100D along with PPNs of such pages. These pagesare stored in destination host 100D at the same MPNs as in step 408.

After step 416, method 400 returns to step 410, and the VM migrationsoftware accesses metadata 152 to determine how many pages of VM memory310 have been dirtied since the last installation of write traces (e.g.,at step 414) and compares the amount of time it would take to retransmitthese dirty pages to the defined threshold. Steps 414 and 416 arerepeated for the dirty pages indicated in metadata 152 and the methodloops back to step 410 if it is determined at step 412 that the amountof time it would take to retransmit these dirty pages is not below thethreshold.

At step 418, the VM migration software begins the process of switchingover VM 1105 to VM 110D by “quiescing” VM 1105. At this point, VM 1105is no longer running and thus no longer modifying VM memory 310. At step420, the VM is resumed as VM 110D, and the VM migration softwaretransfers the device state of VM 1105 from source host 100S todestination host 100D including the states of any virtual devices usedby VM 1105. The VM migration software also transfers a final set ofpages of VM memory 310 to destination host 100D along with the PPNs ofsuch pages. These pages are stored in destination host 100D at the sameMPNs as in step 408. The final set includes the pages of VM memory 310that have been dirtied since the last installation of write traces(e.g., at step 414). Until these pages are copied over to destinationhost 100D, these pages are referred to herein as “remote” VM memorypages, and backing metadata 132 maintained in destination host 100Dindicates that these pages are “remote” pages. After these pages arecopied over, backing metadata 132 is updated to indicate that thesepages are no longer “remote.” After the final set of memory pages iscopied and the device state of VM 110S is restored in VM 110D, VM 110Dbegins executing guest instructions. At step 422, the VM migrationsoftware powers off VM 110S in source host 100S. After step 422, method400 ends, and VM 110D continues executing on destination host 100D.

FIG. 5 is a flow diagram of steps carried out by the VM migrationsoftware to perform a method 500 when the receipt of a zero page isdetected at a destination host during VM migration, according to anembodiment. Method 500 will be explained with reference to source anddestination hosts 100S and 100D of FIG. 3A.

Method 500 begins at step 502, where the VM migration software detectsat destination host 100D that a small page of zeros, e.g., a 4-KB pagestoring only zeros, has been received from source host 100S. In someembodiments, to preserve bandwidth, the small page of zeros are notactually transmitted. Instead, only metadata indicating that the smallpage is a zero page is transmitted.

At step 504, the VM migration software determines whether, at sourcehost 100S, the small page is backed by a large page, e.g., is part of a2-MB page. For example, kernel 130 of destination host 100D may checkbacking metadata 132 for each migrated page indicating whether amigrated page is backed by a large page. This information may betransmitted as metadata along with the small pages to destination host100D, e.g., during the first iteration of the pre-copying phase. If thedetected small page is not part of a large page, method 500 moves tostep 506, and the VM migration software maps the small page to an MPNcontaining all zeros at destination host 100D. After step 506, method500 ends.

Returning to step 504, if the detected small page is part of a largepage of memory, method 500 moves to step 508. At step 508, the VMmigration software locates a small page in destination host 100D thatcorresponds to the detected small page of zeros. The VM migrationsoftware locates the small page by making a kernel call to check backingmetadata 132 for the MPN corresponding to the PPN of the detected smallpage. At step 510, the VM migration software stores all zeros in thecorresponding small page of destination host 100D. After step 510,method 500 ends.

FIG. 6 is a flow diagram of steps carried out by the VM migrationsoftware to perform a method 600 when the receipt of a remote small pageof memory is detected at a destination host during VM migration,according to an embodiment. Method 600 will be explained with referenceto source and destination hosts 100S and 100D of FIG. 3A.

Method 600 begins at step 602, where the VM migration software detectsat destination host 100D, that a remote small page has been receivedfrom source host 100S . There are two operations that may result in sucha detection: a “push” operation and a “pull” operation. With a pushoperation, the detected remote small page is copied from source host100S after the pre-copying phase of a migration. The detected remotesmall page is thus copied along with the remaining dirty pages of themigration. With a pull operation, a migrated VM resumes and attempts totouch a remote page for which updated content has not yet been copied todestination host 100D, resulting in a “remote page fault.” In responseto the remote page fault, destination host 100D specifically requeststhe updated content of the remote page from source host 100S. Sourcehost 100S then transmits the updated content to destination host 100D asthe detected remote small page.

At step 604, the VM migration software locates an MPN of the small pagein destination host 100D that corresponds to the detected remote smallpage, in which the update content of the remote small page will bestored. It should be noted herein that the MPN for the remote small pageis not freed up, the MPN being either specific to the remote small pageor part of a large page. The VM migration software locates the smallpage by making a kernel call to check backing metadata 132 for the MPNcorresponding to the PPN of the detected remote small page. At step 606,the VM migration software stores the updated contents of the remotesmall page in the MPN corresponding to the remote small page. At step608, the VM migration software makes a kernel call to clear the “remote”status of the detected remote small page in kernel metadata 132. Thekernel 130 of destination host 100D then clears the “remote” status, andmethod 600 ends.

In the embodiments described above, destination host 100D determinesthat small pages are backed by large pages by checking the metadatatransmitted by source host 100S and stored in backing metadata 132. Inalternative embodiments, destination host 100D determines that smallpages are backed by large pages by checking nested page tables 142 ofthe migrated VM. For example, if bottom level page tables reference a2-MB page, then it is determined that small pages that are part of this2-MB pages are backed by a large page.

The embodiments described herein may employ various computer-implementedoperations involving data stored in computer systems. For example, theseoperations may require physical manipulation of physical quantities.Usually, though not necessarily, these quantities are electrical ormagnetic signals that can be stored, transferred, combined, compared, orotherwise manipulated. Such manipulations are often referred to in termssuch as producing, identifying, determining, or comparing. Anyoperations described herein that form part of one or more embodimentsmay be useful machine operations.

One or more embodiments of the invention also relate to a device or anapparatus for performing these operations. The apparatus may bespecially constructed for required purposes, or the apparatus may be ageneral-purpose computer selectively activated or configured by acomputer program stored in the computer. Various general-purposemachines may be used with computer programs written in accordance withthe teachings herein, or it may be more convenient to construct a morespecialized apparatus to perform the required operations. Theembodiments described herein may also be practiced with computer systemconfigurations including hand-held devices, microprocessor systems,microprocessor-based or programmable consumer electronics,minicomputers, mainframe computers, etc.

One or more embodiments of the present invention may be implemented asone or more computer programs or as one or more computer program modulesembodied in computer readable media. The term computer readable mediumrefers to any data storage device that can store data that canthereafter be input into a computer system. Computer readable media maybe based on any existing or subsequently developed technology thatembodies computer programs in a manner that enables a computer to readthe programs. Examples of computer readable media are HDDs, SSDs,network-attached storage (NAS) systems, read-only memory (ROM), RAM,compact disks (CDs), digital versatile disks (DVDs), magnetic tapes, andother optical and non- optical data storage devices. A computer readablemedium can also be distributed over a network- coupled computer systemso that computer-readable code is stored and executed in a distributedfashion.

Although one or more embodiments of the present invention have beendescribed in some detail for clarity of understanding, certain changesmay be made within the scope of the claims. Accordingly, the describedembodiments are to be considered as illustrative and not restrictive,and the scope of the claims is not to be limited to details given hereinbut may be modified within the scope and equivalents of the claims. Inthe claims, elements and steps do not imply any particular order ofoperation unless explicitly stated in the claims.

Virtualized systems in accordance with the various embodiments may beimplemented as hosted embodiments, non-hosted embodiments, or asembodiments that blur distinctions between the two. Furthermore, variousvirtualization operations may be wholly or partially implemented inhardware. For example, a hardware implementation may employ a look- uptable for modification of storage access requests to secure non-diskdata. Many variations, additions, and improvements are possible,regardless of the degree of virtualization. The virtualization softwarecan therefore include components of a host, console, or guest OS thatperform virtualization functions.

Boundaries between components, operations, and data stores are somewhatarbitrary, and particular operations are illustrated in the context ofspecific illustrative configurations. Other allocations of functionalityare envisioned and may fall within the scope of the invention. Ingeneral, structures and functionalities presented as separate componentsin exemplary configurations may be implemented as a combined component.Similarly, structures and functionalities presented as a singlecomponent may be implemented as separate components. These and othervariations, additions, and improvements may fall within the scope of theappended claims.

What is claimed is:
 1. A method of preserving the contiguity of largepages of a workload during migration of the workload from a source hostto a destination host, the method comprising: detecting at thedestination host, receipt of a small page of zeros from the source host,wherein, at the source host, the small page is part of one of the largepages of the workload; and upon detecting the receipt of the small pageof zeros, storing, at the destination host, all zeros in a small pagethat is part of one of the large pages of the workload.
 2. The method ofclaim 1, wherein detecting the small page of zeros comprises determiningfrom metadata received from the source host that the small page containsonly zeros.
 3. The method of claim 2, wherein a location of the smallpage of zeros within the large page at the source host is the same as alocation of the small page of zeros within the large page at thedestination host.
 4. The method of claim 1, further comprising:detecting at the destination host, receipt of a small page with contentsthat have been modified since a previous time the small page withmodified contents was received from the source host during themigration, wherein, at the source host, the small page with modifiedcontents is part of another one of the large pages of the workload; andupon detecting the receipt of the small page with modified contents,storing, at the destination host, the modified contents in a small pagethat is part of another one of the large pages of the workload.
 5. Themethod of claim 4, wherein a location of the modified small page withthe modified contents within the other large page at, the source host isthe same as a location of the small page with the modified contentswithin the other large page at the destination host.
 6. The method ofclaim 5, wherein the small page with the modified contents is receivedafter the workload is resumed at the destination host.
 7. The method ofclaim 6, wherein the workload is a virtual machine (VM), and whereinmigrating the VM from the source host comprises quiescing the VM at thesource host and resuming the VM at the destination host.
 8. Anon-transitory computer readable medium comprising instructions that areexecutable by a destination host, wherein the instructions when executedcause the destination host to carry out a method of preserving thecontiguity of large pages of a workload during migration of the workloadfrom a source host to the destination host, said method comprising:detecting at the destination host, receipt of a small page of zeros fromthe source host, wherein, at the source host, the small page is part ofone of the large pages of the workload; and upon detecting the receiptof the small page of zeros, storing, at the destination host, all zerosin a small page that is part of one of the large pages of the workload.9. The non-transitory computer readable medium of claim 8, whereindetecting the small page of zeros comprises determining from metadatareceived from the source host that the small page contains only zeros.10. The non-transitory computer readable medium of claim 9, wherein alocation of the small page of zeros within the large page at the sourcehost is the same as a location of the small page of zeros within thelarge page at the destination host.
 11. The non-transitory computerreadable medium of claim 8, the method further comprising: detecting atthe destination host, receipt of a small page with contents that havebeen modified since a previous time the small page with modifiedcontents was received from the source host during the migration,wherein, at the source host, the small page with modified contents ispart of another one of the large pages of the workload; and upondetecting the receipt of the small page with modified contents, storing,at the destination host, the modified contents in a small page that ispart of another one of the large pages of the workload.
 12. Thenon-transitory computer readable medium of claim 11, wherein a locationof the modified small page with the modified contents within the otherlarge page at the source host is the same as a location of the smallpage with the modified contents within the other large page at thedestination host.
 13. The non-transitory computer readable medium ofclaim 12, wherein the small page with the modified contents is receivedafter the workload is resumed at the destination host.
 14. Thenon-transitory computer readable medium of claim 13, wherein theworkload is a virtual machine (VM), and wherein migrating the VM fromthe source host comprises quiescing the VM at the source host andresuming the VM at the destination host.
 15. A computer systemcomprising: a source host; and a destination host configured to carryout a method of preserving the contiguity of large pages of a workloadduring migration of the workload from the source host to the destinationhost, the method comprising: detecting at the destination host, receiptof a small page of zeros from the source host, wherein, at the sourcehost, the small page is part of one of the large pages of the workload,and upon detecting the receipt of the small page of zeros, storing, atthe destination host, all zeros in a small page that is part of one ofthe large pages of the workload.
 16. The computer system of claim 15,wherein detecting the small page of zeros comprises determining frommetadata received from the source host, that the small page containsonly zeros.
 17. The computer system of claim 16, wherein a location ofthe small page of zeros within the large page at the source host is thesame as a location of the small page of zeros within the large page atthe destination host.
 18. The computer system of claim 15, the methodfurther comprising: detecting at the destination host, receipt of asmall page with contents that have been modified since a previous timethe small page with modified contents was received from the source hostduring the migration, wherein, at the source host, the small page withmodified contents is part of another one of the large pages of theworkload; and upon detecting the receipt of the small page with modifiedcontents, storing, at the destination host, the modified contents in asmall page that is part of another one of the large pages of theworkload.
 19. The computer system of claim 18, wherein a location of themodified small page with the modified contents within the other largepage at the source host is the same as a location of the small page withthe modified contents within the other large page at the destinationhost.
 20. The computer system of claim 19, wherein the small page withthe modified contents is received after the workload is resumed at thedestination host, the workload is a virtual machine (VM), and migratingthe VM from the source host comprises quiescing the VM at the sourcehost and resuming the VM at the destination host.